import Https from '@/utils/https'

// 接口测试
const queryTestReq = (params) => Https.post('/api/v1/offline/integration/api/http/test', params, { needCode: true })

// 预览
const queryPreviewReq = (params) => Https.post('/api/v1/offline/integration/api/preview', params, { needCode: true })

// 获取数据目标
const queryGetDatabasesReq = (params) => Https.get('/api/v1/offline/integration/api/getDatabases', params)

// 获取目标表
const queryGetTargetTablesReq = (params) => Https.get('/api/v1/offline/integration/api/getTargetTables', params)

// 获取一键建表语句
const queryGetCreateTableDDLReq = (params) => Https.post('/api/v1/offline/integration/api/getCreateTableDDL', params)

// 一键建表
const querySaveTargetTableReq = (params) => Https.post('/api/v1/offline/integration/api/saveTargetTable', params)

// 字段映射
const queryGetTagetTableFieldsReq = (params) => Https.get('/api/v1/offline/integration/api/getTagetTableFields', params)

// 新建-保存编辑任务
const querySaveTaskReq = (params) => Https.post('/api/v1/offline/integration/api/http/saveTask', params, { needCode: true })

// 查看任务
const queryGetTaskByIdReq = (params) => Https.get('/api/v1/offline/integration/api/http/getTaskById', params, { needCode: true })

// 重跑任务
const queryReRunTaskReq = (params) => Https.get('/api/v1/offline/integration/api/start', params, { needCode: true })

// 结束任务
const queryStopReq = (params) => Https.post('/api/v1/offlineDev/task/stop', params, { needCode: true, json: false })

// 日志
const queryLogReq = (params) => Https.get('/api/v1/offlineDev/task/log', params, { needCode: true })
export {
  queryTestReq, queryPreviewReq, queryGetDatabasesReq, queryGetTargetTablesReq, queryGetCreateTableDDLReq, querySaveTargetTableReq, queryGetTagetTableFieldsReq, querySaveTaskReq, queryGetTaskByIdReq, queryReRunTaskReq, queryStopReq, queryLogReq,
}
